# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -mtriple aarch64 -run-pass=aarch64-postlegalizer-lowering -global-isel -verify-machineinstrs %s -o - | FileCheck %s

---
name:            truncstore_s8
legalized:       true
body: |
  bb.0.entry:
    liveins: $x0
    ; CHECK-LABEL: name: truncstore_s8
    ; CHECK: %ptr:_(p0) = COPY $x0
    ; CHECK: %val:_(s32) = COPY $w1
    ; CHECK: G_STORE %val(s32), %ptr(p0) :: (store (s8))
    %ptr:_(p0) = COPY $x0
    %val:_(s32) = COPY $w1
    %trunc:_(s8) = G_TRUNC %val
    G_STORE %trunc(s8), %ptr(p0) :: (store (s8))
...
---
name:            truncstore_vector
legalized:       true
body: |
  bb.0.entry:
    liveins: $x0
    ; CHECK-LABEL: name: truncstore_vector
    ; CHECK: %ptr:_(p0) = COPY $x0
    ; CHECK: %val:_(<4 x s32>) = COPY $q0
    ; CHECK: %trunc:_(<4 x s8>) = G_TRUNC %val(<4 x s32>)
    ; CHECK: G_STORE %trunc(<4 x s8>), %ptr(p0) :: (store (<4 x s8>))
    %ptr:_(p0) = COPY $x0
    %val:_(<4 x s32>) = COPY $q0
    %trunc:_(<4 x s8>) = G_TRUNC %val
    G_STORE %trunc(<4 x s8>), %ptr(p0) :: (store (<4 x s8>))
...
---
name:            truncstore_too_large
legalized:       true
body: |
  bb.0.entry:
    liveins: $x0
    ; CHECK-LABEL: name: truncstore_too_large
    ; CHECK: %ptr:_(p0) = COPY $x0
    ; CHECK: %val:_(s128) = COPY $q0
    ; CHECK: %trunc:_(s32) = G_TRUNC %val(s128)
    ; CHECK: G_STORE %trunc(s32), %ptr(p0) :: (store (s32))
    %ptr:_(p0) = COPY $x0
    %val:_(s128) = COPY $q0
    %trunc:_(s32) = G_TRUNC %val
    G_STORE %trunc(s32), %ptr(p0) :: (store (s32))
...
